#ifndef TITLEBAR_H
#define TITLEBAR_H

#include <QWidget>
#include <QToolButton>
#include <QLabel>
#include <QHBoxLayout>
#include <QMouseEvent>

class TitleBar : public QWidget
{
	Q_OBJECT
public:
	explicit TitleBar(QWidget *parent = nullptr);

signals:
	void closeWindow();
	void moved(const QPoint &pos);
    void expand();
    void add();
    void pressed();
    void released();

private:
	QToolButton *closeBtn;

	QLabel *titleLbl;

    QToolButton *addBtn;

    QHBoxLayout *mainLyt;

	bool mousePressedFlag;

	QPoint curPos;

    QFile *qssFile;
    QString qssData;

private slots:
    void on_closeBtn_clicked();

    void on_addBtn_clicked();

	void mousePressEvent(QMouseEvent *event);
    void mouseMoveEvent(QMouseEvent *event);
	void mouseReleaseEvent(QMouseEvent *event);

public:
    enum {
        FoldStatusHide,
        FoldStatusShow,
    };
    void setTitle(const QString &title);

};

#endif // TITLEBAR_H
